package com.md.config.database.slave;

import com.google.common.collect.Lists;
import com.md.util.ObjectUtil;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.List;

@ConfigurationProperties(
  prefix = "datasource"
)
@Configuration
@Data
public class SlaveDataSourceConfig {
  private Boolean enableNote;
  private DataSourceProperty master;
  private List<DataSourceProperty> slave;

  public List<DataSourceProperty> getSlave() {
    if (ObjectUtil.isEmpty(slave)) {
      return Lists.newArrayList();
    }
    return slave;
  }
}
